/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mailclient;

/**
 *
 * @author Vipar
 */
public class EmailContent extends javax.swing.JDialog {

    /**
     * Creates new form EmailContent
     */
    public EmailContent(java.awt.Frame parent, boolean modal, String from, String subject, String emailtext) {
        super(parent, modal);
        initComponents();
        emailFromAddressLabel.setText(from);
        emailSubjectLineLabel.setText(subject);
        System.out.println(emailtext);
        emailTextArea.setText(emailtext);
        System.out.println(emailTextArea.getText());
        setVisible(true);
    }
    
    
    
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        emailTextPane = new javax.swing.JPanel();
        emailScroll = new javax.swing.JScrollPane();
        emailTextArea = new javax.swing.JEditorPane();
        emailLabelPane = new javax.swing.JPanel();
        emailFromLabel = new javax.swing.JLabel();
        emailFromAddressLabel = new javax.swing.JLabel();
        emailSubjectLabel = new javax.swing.JLabel();
        emailSubjectLineLabel = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        emailTextPane.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        emailTextArea.setEditable(false);
        emailTextArea.setContentType("text/html"); // NOI18N
        emailTextArea.setAutoscrolls(false);
        emailScroll.setViewportView(emailTextArea);

        javax.swing.GroupLayout emailTextPaneLayout = new javax.swing.GroupLayout(emailTextPane);
        emailTextPane.setLayout(emailTextPaneLayout);
        emailTextPaneLayout.setHorizontalGroup(
            emailTextPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(emailTextPaneLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(emailScroll)
                .addContainerGap())
        );
        emailTextPaneLayout.setVerticalGroup(
            emailTextPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(emailTextPaneLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(emailScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 393, Short.MAX_VALUE)
                .addContainerGap())
        );

        emailLabelPane.setMinimumSize(new java.awt.Dimension(68, 230));
        emailLabelPane.setLayout(new java.awt.GridLayout(0, 2));

        emailFromLabel.setText("From:");
        emailLabelPane.add(emailFromLabel);
        emailLabelPane.add(emailFromAddressLabel);

        emailSubjectLabel.setText("Subject:");
        emailLabelPane.add(emailSubjectLabel);
        emailLabelPane.add(emailSubjectLineLabel);

        jButton1.setText("Close");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(emailLabelPane, javax.swing.GroupLayout.PREFERRED_SIZE, 465, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addComponent(emailTextPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(emailLabelPane, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(emailTextPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
        dispose();
    }//GEN-LAST:event_jButton1ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(EmailContent.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(EmailContent.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(EmailContent.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(EmailContent.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel emailFromAddressLabel;
    private javax.swing.JLabel emailFromLabel;
    private javax.swing.JPanel emailLabelPane;
    private javax.swing.JScrollPane emailScroll;
    private javax.swing.JLabel emailSubjectLabel;
    private javax.swing.JLabel emailSubjectLineLabel;
    private javax.swing.JEditorPane emailTextArea;
    private javax.swing.JPanel emailTextPane;
    private javax.swing.JButton jButton1;
    // End of variables declaration//GEN-END:variables
}
